package guoanmaker.operator.business.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import guoanmaker.operator.business.service.MessageTypeService;
import guoanmaker.operator.helper.common.AjaxJson;
import guoanmaker.operator.helper.common.abstractobj.ApiController;
import io.swagger.annotations.ApiOperation;


@RestController
@RequestMapping(ApiController.MESSAGE_URL)
public class MessageTypeController {
	
	@Resource
	private  MessageTypeService messageTypeService;
	@Resource
	private AjaxJson ajaxJson;
	
	@ApiOperation(value = "服务端消息类型列表接口")
	@RequestMapping(value="MessageForBusiness",method = RequestMethod.POST)
	public AjaxJson MessageForBusiness(String businessid){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(messageTypeService.MessageForBusiness(businessid));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	
	@ApiOperation(value = "将未读设置成已读消息")
	@RequestMapping(value="MessageSetIsread",method = RequestMethod.POST)
	public AjaxJson MessageSetIsread(String businessid){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(messageTypeService.MessageSetIsread(businessid));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	
	
	
	
	

}
